<?php 
/** 南京润琦 ID=25 助力活动 **/
function hidtel($phone){
         return  preg_replace('/(1[34578]{1}[0-9])[0-9]{4}([0-9]{4})/i','$1****$2',$phone);
 } 
//截取utf8字符串 
function utf8Substr($str, $from, $len) 
{  
return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'. 
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s', 
'$1',$str); 
} 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" id="viewport" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <title><?php echo $news['title']; ?></title>
    <meta name="description" content="微信模板" />
    <meta name="keywords" content="" /> 
    <link href="__PUBLIC__/styles/default/css/base.css" type="text/css" rel="stylesheet" />
    <link href="__PUBLIC__/styles/default/css/njrq.css?v=11" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="__PUBLIC__/styles/default/js/jquery-1.8.0.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/styles/default/js/scroll.js" charset="utf-8"></script>
    <script type="text/javascript">
      $(function(){
        setTimeout(function () { 
                $("div.list_lh").myScroll({
                  speed:60, 
                  rowHeight:25 
                });
        }, 10000);
        
      });
      </script>

    <script type="text/javascript">
    $(function(){
        countDown($("#dtime").text(),"#colockbox1");
        $('#name').focus(function(){
            $('.show').empty();
        });
        $('#tel').focus(function(){
            $('.show').empty();
        });
      });
      function countDown(time,id){
        var day_elem = $(id).find('.day');
        var hour_elem = $(id).find('.hour');
        var minute_elem = $(id).find('.minute');
        var second_elem = $(id).find('.second');
        var end_time = new Date(time).getTime(),//月份是实际月份-1
        sys_second = (end_time-new Date().getTime())/1000;
        var timer = setInterval(function(){
          if (sys_second > 1) {
            sys_second -= 1;
            var day = Math.floor((sys_second / 3600) / 24);
            var hour = Math.floor((sys_second / 3600) % 24);
            var minute = Math.floor((sys_second / 60) % 60);
            var second = Math.floor(sys_second % 60);
            day_elem && $(day_elem).text(day);//计算天
            $(hour_elem).text(hour<10?"0"+hour:hour);//计算小时
            $(minute_elem).text(minute<10?"0"+minute:minute);//计算分钟
            $(second_elem).text(second<10?"0"+second:second);//计算秒杀
          } else { 
            clearInterval(timer);
          }
        }, 1000);
      }
            
    function oncheck()
    {
        var tel = $('#tel').val();
        var name = $('#name').val();
        if(name == "" || tel == "")
        {
            $('.show').html("姓名或者手机号码不能为空!");
            return false;
        }
        re= /^(13[0-9]|15[012356789]|18[02356789]|14[57]|17[0-9])[0-9]{8}$/;
        if(!re.test(tel))
        {
            $('.show').html("手机号码格式不正确!");
            return false;
        }
        
        if(tel.length != 11)
        {
            $('.show').html("手机号码必须为11位数字!");
            return false;
        }
        
        return true;
    }
  </script>
      
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
  wx.config({
    debug: false,
    appId: '{$signPackage["appId"]}',
    timestamp: '{$signPackage["timestamp"]}',
    nonceStr: '{$signPackage["nonceStr"]}',
    signature: '{$signPackage["signature"]}',
    jsApiList: [
      // 所有要调用的 API 都要加到这个列表中
      'onMenuShareTimeline','onMenuShareAppMessage'
    ]
  });
  wx.ready(function () {
    // 在这里调用 API
 
    wx.onMenuShareTimeline({
      title: "2000元基金+健身年卡免费送，更有港澳双飞五日游等震撼大奖等你拿！", // 分享标题
	  link: "http://www.dscm.com.cn__SELF__&fx_id={$fx_id}", // 分享链接
      desc: "助力南京润琦装饰，给你一个温馨的家，万元心动大礼震撼来袭，赶快助力吧...", // 分享描述
      imgUrl: "http://www.dscm.com.cn__PUBLIC__/styles/default/images/njrq_01.jpg", // 分享图标
      trigger: function () {
          //alert("点击分享：");
      },
      success: function () { 
          // 用户确认分享后执行的回调函数
          //alert("分享成功");
      },
      cancel: function () { 
          // 用户取消分享后执行的回调函数
          //alert("用户取消分享");
      }
    });
  
  	wx.onMenuShareAppMessage({
      	title: "2000元基金+健身年卡免费送，更有港澳双飞五日游等震撼大奖等你拿！", // 分享标题
	  	link: "http://www.dscm.com.cn__SELF__&fx_id={$fx_id}", // 分享链接
     	desc: "助力南京润琦装饰，给你一个温馨的家，万元心动大礼震撼来袭，赶快助力吧...", // 分享描述
      	imgUrl: "http://www.dscm.com.cn__PUBLIC__/styles/default/images/njrq_01.jpg", // 分享图标
    	type: 'link', // 分享类型,music、video或link，不填默认为link
		success: function () { 
			// 用户确认分享后执行的回调函数  
		},
		cancel: function () { 
			// 用户取消分享后执行的回调函数
		}
	 });
  });
</script>
</head>
<body> 
<!--	__SELF__<br/> __PUBLIC__<br/>
    参加人数：{$cjrs}<br/> 
    总助力人数：{$zlrs}<br/>
    阅读次数：{$ydcs}<br/>
	
    当前用户是否参加{$is_join}<br/>
    分享用户是否参加{$is_fx_join}<br/>
    当前用户币{$coin}<br/>
    分享币{$fx_coin}<br/>
    wx——id{$wx_id}<br/>
    fx——id{$fx_id}<br/>{$wx_user['name']} 位置:{$position}-->

    <div id="all">  
         <div class="header1">
          	<img src="__PUBLIC__/styles/default/images/njrq_01.jpg" width="100%" />
            <img src="__PUBLIC__/styles/default/images/njrq_02.jpg" width="100%" /> 
            <img src="__PUBLIC__/styles/default/images/njrq_03.jpg" width="100%" /> 
         </div>
         
        <!--<div style="margin-top:10px;background-color:#fff;font-size:20px;height:40px;line-height:40px;text-align:center;font-family:Arial, Helvetica, sans-serif;">活动倒计时，距离结束还有</div> -->
        <div id="dtime" style="display:none"><?php  echo date("Y/m/d H:i:s", $news['jssj']);?></div>
        <div class="colockbox" id="colockbox1" style="text-align:center;margin-bottom:0px;"><span class="day">00</span> 天 <span class="hour">00</span> 时 <span class="minute">00</span> 分 <span class="second">00</span> 秒 </div>

        <div class="help" id="wejoin">
 			
            
        	<?php if($fx_id == $wx_id){ ?>
            
          		<?php if($is_join) {echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;padding:0 10px;color:#F36;">您('.$wx_user['name'].')现在有'.$coin.'助力币</p>'; }else{
						echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;padding:0 10px;color:#F36;">您还没有参加活动，赶快来参加吧.</p>';} ?>
                        
		  	<?php }else{ ?>
            	<?php if($is_fx_join){ ?>
          			<h2 style="margin:30px 0;line-height:30px;font-size:26px;color:#F36;">大奖来袭，帮TA助力！<br/>(<?php echo $fx_user['name'];?>已有<?php echo $fx_coin;?>助力币)</h2>
                <?php }else{?>
                	<?php if($is_join) {echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;padding:0 10px;color:#F36;">您('.$wx_user['name'].')现在有'.$coin.'助力币</p>'; }else{
						echo '<p  style="margin:30px 0;line-height:30px;font-size:26px;color:#F36;padding:0 10px;">您还没有参加活动，赶快来参加吧.</p>';} ?>
                <?php } ?>
		  	<?php }?>
            
                      
          <div class="fx_notice">
            <p>
            	<?php if($is_fx_join){ ?>
          			<span style="color:red;"><?php echo $fx_user['name'];?></span> 当前有<span class="zlb"><?php echo $fx_coin;?></span>助力币;<br/> 排名：第<?php echo $position;?>名（相同助力币不计）
                <?php }else{?>
                	当前用户还没有参加活动哦，赶紧来参加吧.
                <?php } ?>
            </p>
          </div>
            
		  <div class="notice1">
            <p>
            </p>
          </div>

          <div class="helpdiv"></div>
          <div class="help1">
            <div class="help2">
              <div class="help3">
                <div style="line-height: 50px;margin-top: 40px;">
                	帮友助力 <br/>
                	赢取豪礼
                </div>	
              </div>
            </div>
          </div>
<!--          <div class="help1">
		  	<img src="__PUBLIC__/styles/default/images/njrq_171.jpg" width="100%" class="show1"/>
            <img src="__PUBLIC__/styles/default/images/njrq_172.jpg" width="100%" class="show2" style="display:none;"/>
		  </div>-->
          	    
<!--http://'.$_SERVER['HTTP_HOST'].'/include1/gz/activity/njrq.php?id='.$wx_id.'&fx_id='.$wx_id.-->
          <div class="notice2">
            <form action="index.php?s=/Wap/Tzhuli/weixinadd/" method="post" enctype="multipart/form-data" onsubmit="return oncheck()">   
                     
			<?php if($is_join) {echo '<p><a style="color:#fff;" href="http://www.dscm.com.cn/xcrm/index.php?s=/Wap/Tzhuli/index/hdid/'.$hdid.'">您已参加活动,您现在有'.$coin.'助力币<br/>点击进入你的活动页</a></p><a href="javascript:void();" class="none">Close</a>'; }
            else{?> <p>您的姓名:           
			<input type="text" name="name" value="<?php echo $wx_user['name'];?>" id="name" /></p> 
            <input name="id" type="hidden" value="<?php echo $wx_id;?>" />
            <input name="hdid" type="hidden" value="<?php echo $hdid;?>" />
            <p>您的手机: <input type="text" name="tel" value="<?php echo $wx_user['tel'];?>" id="tel" /></p>
            <input type="submit" value="提交" class="btn1" />
			<input type="button" value="取消" class="btn1 none" /><?php }?>
			<div class="show"></div>
            <!--<a href="javascript:void();" class="none">Close</a>-->
          </form>
          </div>

          <div class="notice3">
          		<?php if($is_fx_join){ ?>
          			<span style="color:red;"><?php echo $fx_user['name'];?></span> 当前有<span class="zlb"><?php echo $fx_coin;?></span>助力币;<br/> 排名：第<?php echo $position;?>名（相同助力币不计）
                <?php }else{?>
                	当前用户还没有参加活动哦，赶紧来参加吧.
                <?php } ?>
                <br/>
                <a href="javascript:void();" class="none">Close</a>
          </div>

		  <div class="help4">
            <!--<a href="javascript:void();" class="a1">
            <?php if($is_join){ ?>
          			<img src="__PUBLIC__/styles/default/images/njrq_081.jpg" width="100%" />
                <?php }else{?>
                	<img src="__PUBLIC__/styles/default/images/njrq_082.jpg" width="100%" />
                <?php } ?>
            </a>
            <a href="javascript:void();" class="a2"><img src="__PUBLIC__/styles/default/images/njrq_09.jpg" width="100%" /></a>-->
            <a href="javascript:void();" class="a1"><?php if($is_join){echo "我的活动页";}else{echo "我要参加";} ?></a>
            <a href="javascript:void();" class="a2">查看我的钱罐</a>
          </div>
          
        </div>
        <script>
		
		$(function(){
        	$(".help1").click(function(){
              $(".help1").hide();	
			  /*$('.show1').fadeOut(2000,function(){
				  $('.show2').fadeToggle(2000);
			  });*/
			  $.get("http://www.dscm.com.cn/xcrm/index.php?s=/Wap/Tzhuli/zhuliapi/wxid/{$wx_id}/uid/{$openid}/wx1/{$fx_id}/hdid/{$hdid}",function(data,status){
				//alert(data.split(",")[0]);  
				$(".notice1 p").text(data.split(",")[0]); 
				$(".zlb").text(String(data.split(",")[1])); 
				$(".notice1").fadeToggle(1000).fadeOut(2000,function(){
				   $('.fx_notice').fadeToggle(2000);
				});
			  });	
 				
          	});
		   
			// 我要参加活动点击事件；
		   $(".a1").click(function(){
			  $(".notice2").animate({
				top:'50px',
				left:'12px'
			  });
			});

			$('.none').click(function(){
			  $(".notice2").animate({
				top:'50px',
				left:'-999px'
			  });
			}); 
       
	   		// 查看收钱罐点击事件处理；
            $(".a2").click(function(){
                  $(".notice3").animate({
                    top:'50px',
                    left:'12px'

                  });
                });

                $('.none').click(function(){
                  $(".notice3").animate({
                    top:'50px',
                    left:'-999px'
                  });
                });  


                $(".notice2 input[type='text']").focus(function(){
                  $(this).val("");
                })
            });
        </script>
        
        <img src="__PUBLIC__/styles/default/images/njrq_05.jpg" width="100%" /> 
        <img src="__PUBLIC__/styles/default/images/njrq_06.jpg" width="100%" /> 
        <img src="__PUBLIC__/styles/default/images/njrq_07.jpg" width="100%" /> 
        <img src="__PUBLIC__/styles/default/images/njrq_08.jpg" width="100%" /> 
        <img src="__PUBLIC__/styles/default/images/njrq_09.jpg" width="100%" /> 

		<!--<div class="phb">
        	<p><span>总助力次数：{$zlrs}(次)</span></p>
        </div>-->

        <div class="list">  
          <h4><span>排行</span><span>姓名</span><span style="width:25%;">手机号</span><span style="width:25%;">助力币</span></h4>
          <div class="list_lh" style="height:auto;">
          <ul><?php
		  	$i=1;
		  	foreach($zhulitop AS $one){?> 
           <li><span><?php echo $i;$i++; $wxusz=M('wxuser')->getById($one['uid']); ?></span><span><?php echo utf8Substr($wxusz['name'], 0, 3);?></span><span style="width:25%;"><?php echo hidtel($wxusz['tel']);?></span><span style="width:25%;"><?php echo $one['zlb'];?>助力币</span></li>
		  <?php }?>
          </ul>
        </div>

          <h3 style="margin-bottom:0px;height:30px;line-height:30px;color:#ffd200;">阅读次数：{$ydcs}（次），参加人数：{$cjrs}(人)</h3>

		  <h3 style="height:20px;line-height:20px;color:#ffd200;margin-bottom:45px;">咪游网络</h3>    
        </div>
        
        <!--<img src="__PUBLIC__/styles/default/images/njrq_11.jpg" width="100%" style="margin-bottom:25px;"/>-->
        
        <div id="footer">
          <a href="#wejoin"><?php if($aa){echo $aa;}else	  if($news['kssj']>time()){
				  echo '活动尚未开始,敬请期待!';
				  }else if($news['jssj']<time()){
					   echo '活动已结束,下期再见!';
					  }else{
						      echo '活动进行中,邀友助力吧!';
						  }
			  
			  ?></a>
        </div>

<!--            <script>
              $(function(){
                $('.a3').click(function(){
                  $('.share-box').slideToggle("slow");
                });

                $('.hide').click(function(){
                  $('.share-box').hide();
                });
              });
            </script>-->
    </div> 
</body>
</html>